home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16610 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: user1.mnsinc.com!keys
  2. From: keys@mnsinc.com (Paul Speed)
  3. Newsgroups: comp.lang.c++,rec.games.programmer,alt.msdos.programmer,comp.programming
  4. Subject: Re: Young programmers read me.
  5. Followup-To: comp.lang.c++,rec.games.programmer,alt.msdos.programmer,comp.programming
  6. Date: 11 Apr 1996 14:10:01 GMT
  7. Organization: Monumental Network Systems
  8. Message-ID: <4kj3rp$11d@news1.mnsinc.com>
  9. References: <4icpp9$7hr@barad-dur.nas.com> <aidan-0404961557290001@meathook.intac.com> <3165AD94.6F3A@datalytics.com> <j-jahnke-0604960016160001@ntcs-ip8.uchicago.edu> <4keejc$lpi@tpd.dsccc.com> <Pine.OSF.3.91.960411093444.20958D-100000@bud.cc.swin.edu.au> <gfarrow.829193316@rainbow>
  10. NNTP-Posting-Host: user.mnsinc.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Glenn Farrow (gfarrow@rainbow.rmii.com) wrote:
  14. : John Joseph Newbigin <079519@bud.cc.swin.edu.au> writes:
  15.  
  16. : >But it is a lot easier to read
  17.  
  18. : >if(something_happened)
  19. : >{
  20. : >     do_something_else();
  21. : >}
  22. : >is_n't_it();   :)
  23.  
  24. : Nonesense.  This style is extremely annoying because it spreads the code out
  25. : too much, it increases the amount you have to page around a source file.  
  26. : Putting "{" on a separate line is a waste of space that should be occupied
  27. : by code.
  28.  
  29. :                             Glenn
  30.  
  31.  
  32.     Sure, I can understand that this might be a problem if you're 
  33. still using edlin. :)  This is really a personal preference issue and 
  34. nobody is going to change anyone else's mind.  My problem with the less 
  35. space argument is that it implies that you don't comment your code either.
  36. Not to mention the fact that you might as well shove most of your code 
  37. onto the same lines, only line-breaking when absolutely needed.
  38.  
  39. void foo(int i, char *list){int t;for(t=0;t<i;t++){printf("#%i",t);
  40. printf("%s\n",list[t]);}printf("%i total.\n",t);}
  41.  
  42.     Wow!  Look at how much space that saved.  I could put all my code 
  43. in just two or three pages.  :)  I much prefer.
  44.  
  45. /* Function to do nothing 
  46.  * Parms:  i = num of items, list = list of items */
  47. void foo(int i, char *list)
  48. {
  49.     int t;
  50.  
  51.     /* Go through entire list */
  52.     for(t = 0; t < i; t++)
  53.     {
  54.         /* Write the item to stdout */
  55.         printf("#%i ", t);
  56.         printf("%s\n", list[t]);
  57.     }
  58.  
  59.     /* Sum it up */
  60.     printf("%i total.\n", t);
  61. }
  62.  
  63.     When you waste brain cycles to decipher code that's been crammed 
  64. together, you lose some cycles you could have been using to do something 
  65. else.
  66.  
  67.     -Keys
  68.  
  69.